<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- 你也能执行一次性地插值，当数据改变时，插值处的内容不会更新 -->
      <span v-once>{{msg}}</span>

      <div>{{msg}}</div>
      <button v-on:click="say">点击</button>
      <!-- v-on:click简写  @click -->
      <button @click="say">点击</button>
      <!-- 鼠标  click dblclick mouseover mouserout mousedown mouseup mousemove 
          mouseenter  mouseleave  contextmenu mousewheel
      -->
      <!-- 
          键盘: keydown keypress  keyup 
       -->
      <!-- 表单
          blur  focus  submit reset change  input  
      -->
      <!-- 
          resize  scroll  
       -->
      <div
        @contextmenu="menu"
        style="width:200px;height: 200px; background:red;"
      >
        ssss
      </div>
    </div>
    <script src="vue.js"></script>
    <script>
      var vm = new Vue({
        el: '#app',
        data() {
          return {
            msg: '中秋节'
          }
        },
        methods: {
          //组件函数和事件函数的放置位置
          say() {
            alert(1)
            this.msg = '儿童节'
          },
          run() {
            alert('跑')
          },
          menu() {
            console.log(1111111)
          }
        }
      })
      console.log(vm)
      // 全局实例的使用 $data 数据
      vm.msg = '国庆节'
      vm.$data.msg = '光棍节'
      // $el  根元素
      vm.$el.style.background = 'skyblue'
      //函数调用
      vm.run()
    </script>
  </body>
</html>
